/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ma.projet.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Maison
 */
@Entity
@Table(name = "site")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Site.findAll", query = "SELECT s FROM Site s"),
    @NamedQuery(name = "Site.findBySiteID", query = "SELECT s FROM Site s WHERE s.siteID = :siteID"),
    @NamedQuery(name = "Site.findByZoneID", query = "SELECT s FROM Site s WHERE s.zoneID = :zoneID"),
    @NamedQuery(name = "Site.findByLibelle", query = "SELECT s FROM Site s WHERE s.libelle = :libelle"),
    @NamedQuery(name = "Site.findByActive", query = "SELECT s FROM Site s WHERE s.active = :active")})
public class Site implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "siteID")
    private Long siteID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "zoneID")
    private long zoneID;
    @Size(max = 254)
    @Column(name = "libelle")
    private String libelle;
    @Column(name = "active")
    private Boolean active;
    @JoinColumn(name = "classID", referencedColumnName = "classID")
    @ManyToOne(optional = false)
    private Classe classID;
    @OneToMany(mappedBy = "siteID")
    private List<Incident> incidentList;

    public Site() {
    }

    public Site(Long siteID) {
        this.siteID = siteID;
    }

    public Site(Long siteID, long zoneID) {
        this.siteID = siteID;
        this.zoneID = zoneID;
    }

    public Long getSiteID() {
        return siteID;
    }

    public void setSiteID(Long siteID) {
        this.siteID = siteID;
    }

    public long getZoneID() {
        return zoneID;
    }

    public void setZoneID(long zoneID) {
        this.zoneID = zoneID;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public Classe getClassID() {
        return classID;
    }

    public void setClassID(Classe classID) {
        this.classID = classID;
    }

    @XmlTransient
    public List<Incident> getIncidentList() {
        return incidentList;
    }

    public void setIncidentList(List<Incident> incidentList) {
        this.incidentList = incidentList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (siteID != null ? siteID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Site)) {
            return false;
        }
        Site other = (Site) object;
        if ((this.siteID == null && other.siteID != null) || (this.siteID != null && !this.siteID.equals(other.siteID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ma.projet.entities.Site[ siteID=" + siteID + " ]";
    }
    
}
